<?php 
	if(empty($output['address_list'])){
		appMessage('请添加收货地址','index.php?act=member_index&op=address_mod&is_order=1');
	}
?>
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/extend.css">
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/hotel.css">
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/airline.css">
<link href="<?php echo TEMPLATES_PATH;?>/css/btn.css" media="all" rel="stylesheet" type="text/css">
<link href="<?php echo TEMPLATES_PATH;?>/css/checkbox.css" media="all" rel="stylesheet" type="text/css">
<link href="<?php echo TEMPLATES_PATH;?>/css/list.css" media="all" rel="stylesheet" type="text/css">

<style type="text/css">
.getAddress{ padding:5px;}
.cartTit{ height:30px; border-bottom:1px solid #CCC; line-height:30px; padding-left:10px;}
.getAddress li{ margin:5px 0; line-height:22px; border-bottom:1px dashed #CCC;}
.transport_type_dropdownlist{ height:20px; width:120px; font-size:12px !important; font-family:"微软雅黑";}
.wp_data_loading { font-size:14px; background-color: #333; display: none; width:120px; height:16px; color:#FFF; padding: 20px; border:1px solid #92AED1;position: absolute; z-index:30;  filter: alpha(opacity=75); -moz-opacity: 0.75; opacity: .75;}
.data_loading { line-height: 16px; background: url(../images/loading.gif) no-repeat 0 0; padding-left: 30px;}
.order_amount_price{ margin:8px; padding:4px; border:2px solid #F33; line-height:24px; border-radius:8px; box-shadow: 10px 10px 60px 20px pink inset;}
.cart_btn_area{ display:-webkit-box; padding:10px;}
.cart_btn_area .cart_btn{ -webkit-box-flex:1;height:30px;margin:0 2px;background-color: #c00000;font-size:14px;text-align: center;line-height: 30px;vertical-align: middle;border-radius: 5px;}
.cart_btn_area .cart_btn a{ display:block; color:#FFF;}
</style>
<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">兑换礼品确认</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>

<?php //echo '<pre>';print_r($output['pointprod_arr']['pointprod_list']);die;?>
<form method="get" id="porder_form" name="porder_form">

<div id="notEmptyCart" style="display:block">
	<div class="getAddress">
    	<div class="cartTit">收货人地址</div>
    	<ul>
        <?php foreach((array)$output['address_list'] as $k=>$val){ ?>
        	<li address="<?php echo $val['area_info']; ?>&nbsp;&nbsp;<?php echo htmlspecialchars($val['address']); ?>" buyer="<?php echo $val['true_name']; ?>&nbsp;&nbsp;<?php if($val['mob_phone']) echo $val['mob_phone']; else echo $val['tel_phone']; ?>">
                <a href="javascript:void(0);" class="checkbox goods-choose-state <?php if ($k == 0) echo 'checked'; ?>" data-city_id="<?php echo $val['city_id']?>" data-address_id="<?php echo $val['address_id']; ?>" style="margin:0 4px !important;"></a>
                <?php echo $val['area_info']; ?>&nbsp;&nbsp;<?php echo $val['address']; ?>&nbsp;&nbsp; <?php echo $val['true_name']; ?>(收)&nbsp;&nbsp;<?php if($val['mob_phone']) echo $val['mob_phone']; else echo $val['tel_phone']; ?>
            </li>
        <?php } ?>
        </ul>
        
        <div class="cart_btn_area">
            <div class="cart_btn" style="margin: 0 auto; padding:0 10px"><a url="index.php?act=member_index&op=address_mod&is_order=1" onClick="pclicked(this);">+新增收货地址</a></div>
        </div>
                        
		<input type="hidden" id="address_options" name="address_options" value='<?php echo $output['address_list'][0]['address_id'];?>'/>
  		<input type="hidden" id="chooseaddressid" name="chooseaddressid" value='<?php echo $output['address_list'][0]['address_id'];?>'/>
    </div>
 
    <div class="cartTit">确认礼品清单</div>
	<?php if (!empty($output['pointprod_arr']['pointprod_list']) && is_array($output['pointprod_arr']['pointprod_list'])) { ?>
	<ul class="list store_data_list_<?php echo $cart_store_id; ?>">
    	<?php foreach ( $output['pointprod_arr']['pointprod_list'] as $val) { ?>
    	<li class="row">
            <div>
                <div class="goods-info row">  
                    <a url="index.php?act=pointprod&op=pinfo&id=<?php echo $val['pgoods_id']?>" onClick="pclicked(this);">
                        <img class="photo" alt="<?php echo $val['pgoods_name']; ?>" src="<?php echo SiteUrl.DS.$val['pgoods_image_new']; ?>" onerror="this.src='<?php echo TEMPLATES_PATH;?>/images/touch2013/no_100_100.jpg'">
                    </a>
                    <div class="desc">  
                        <span class="title"><a url="index.php?act=pointprod&op=pinfo&id=<?php echo $val['pgoods_id']?>" onClick="pclicked(this);">
                        	<h4 class="cart_item_text" style="height:40px;"><?php echo $val['pgoods_name']; ?></h4></a>
                        </span>  			
                        <div class="pay-info cart_item_price" style="margin-top:0px; line-height:22px; height:22px;">
                            <span class="price">
                                <span class="cart-goods-price-s" ><em><?php echo $val['pgoods_points']; ?></em></span>
                            </span>
						  <span style="color:#999999;">&nbsp;&nbsp;x&nbsp;&nbsp;<?php echo $val['quantity']; ?></span>
                            <span class="price" style="float:right"><em id="item_subtotal"><?php echo $val['onepoints']; ?></em></span>
                        </div>
                    </div>                      
            	</div>
            </div>
		</li>
        <?php }?>
	</ul> 
<?php }?>
		
		
	<div style="padding:10px;background:-webkit-gradient(linear,center bottom,center top,from(#fff),to(#e5e2e2))">
		<input type="text" value="" placeholder="<?php echo $lang['pointcart_step1_message_advice'];?>"  maxlength="200" name="pcart_message" class="postscript_input" style="width:100%; height:22px; font-size:14px; font-family:'微软雅黑';" />
	</div>
	
    <div class="order_amount_price">
    	<div class="price">所需总积分：<?php echo $output['pointprod_arr']['pgoods_pointall']; ?> 分</div>
        <div class="address">寄送至：<em id="confirm_address"></em></div>
        <div class="buyer">收货人：<em id="confirm_buyer"></em></div>
    </div>
    
    <div class="cart_btn_area">
    	<div class="cart_btn">
			 <a url="index.php?act=pointcart" onClick="pclicked(this);">返回兑换列表</a>
        </div>
        <div class="cart_btn">
            <a href="javascript:void(0);" onclick="pclicked('index.php?act=pointcart&op=step2&'+$('form#porder_form').serialize());">兑换完成</a>
        </div>
    </div>
    
</div>
</form>
<script type="text/javascript">
(function(){
	//选择收货地址
	$('.getAddress li').live('click',function(){
		$(this).find('.checkbox').addClass('checked').parent('li').siblings('li').find('.checkbox').removeClass('checked');
		$("#address_options").val($(this).find('.checkbox').data('address_id'));
		$("#chooseaddressid").val($(this).find('.checkbox').data('address_id'));
		$('#confirm_address').html($(this).attr('address'));
		$('#confirm_buyer').html($(this).attr('buyer'));
	});
	
	if($('.getAddress li a').hasClass('checked')){
		var _next = $('.getAddress li a.checked').parent('li');
		$('#confirm_address').html($(_next).attr('address'));
		$('#confirm_buyer').html($(_next).attr('buyer'));
	}
})();
</script>